<?php

class Record {

	private $resource = NULL;

	public function __construct(&$resource) {
		$this->resource = &$resource;
	}

	public function __destruct() {
		$this->free();
	}

	public function free() {
		@mysql_free_result($this->resource);
	}

	public function &asArray() {
		$array = array();
		while ($array[] = mysql_fetch_assoc($this->resource)

			);
		mysql_field_seek($this->resource, 0);
		return $array;
	}

	public function &asObjectArray() {
		$array = array();
		while ($array[] = mysql_fetch_object($this->resource)

			);
		mysql_field_seek($this->resource, 0);
		return $array;
	}

	public function numRows() {
		return mysql_num_rows($this->resource);
	}

}

/* end of record.php */